package cc.ding.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebServlet(urlPatterns = "/menu.action")
public class MenuServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //接收前端参数
        String action = req.getParameter("action");
        HttpSession session = req.getSession();

        //每日打卡
        if (action.equals("punchClock")){
            session.setAttribute("mainRight","/jsp/punchClock.jsp");
        }
        if (action.equals("Staffmanage")){
            session.setAttribute("mainRight","/jsp/Staffmanage.jsp");
        }
        if (action.equals("ygStatistics")){
            session.setAttribute("mainRight","/jsp/ygStatistics.jsp");
        }
        req.getRequestDispatcher("/main.jsp").forward(req,resp);
    }
}
